home *** CD-ROM | disk | FTP | other *** search
- /* A VERY simple demo of the Picture MDEF for programmers.
-
- Picture MDEF © Nigel Perry, 1990-1
-
- Free for personal use and in stacks & applications which are free.
- May not be used for commercial or profit-making purposes or in
- ShareWare without permission.
-
- Nigel Perry (np@doc.ic.ac.uk), Dec 90 & Apr 91.
- */
-
- #include <stdio.h>
- #include <asm.h>
- #include "PicMDEF.h"
-
- main()
- { MenuHandle mh;
- PicHandle ph;
- nrctHand nh;
- EventRecord event;
- WindowPtr wp;
- union { long l; Point pt; } hit;
-
- printf("Picture MDEF Programmers Demo\nSelect Quit to finish\n\n");
-
- /* get resources */
- ph = (PicHandle)GetNamedResource('PICT', "\pDemo");
- nh = (nrctHand)GetNamedResource('nrct', "\pDemo");
- /* get menu */
- mh = NewPicMenu((StringPtr)"\pPicture", ph, nh);
- /* stuff in menu bar */
- InsertMenu(mh, 0);
- DrawMenuBar();
-
- /* loop and print menu/item */
- while(1)
- { if( GetNextEvent(-1, &event)/* && !StdEvent(&event)*/ )
- { if( FindWindow(event.where, &wp) == inMenuBar )
- { hit.l = MenuSelect(event.where);
- printf("Menu: %d Item: %d\n", hit.pt.v, hit.pt.h);
- /* tear off? */
- if(hit.pt.h == -1)
- printf("Palette Loc (%d,%d)\n",
- (*(PicMenuHandle)mh)->tearLoc.v,
- (*(PicMenuHandle)mh)->tearLoc.h);
- /* Quit item, this is a SIMPLE demo! */
- if(hit.l == 0x20001) break;
- HiliteMenu(0);
- }
- }
- }
-
- ReleaseResource(ph);
- ReleaseResource(nh);
- DisposePicMenu(mh);
- }